<template>
	<view class="edit_receiving_address">
		<view class="edit_receiving_address_original">
			<view class="edit_receiving_address_original_title">原地址：</view>
			<view class="edit_receiving_address_original_header">胡泉 17815241574</view>
			<view class="edit_receiving_address_original_info">广东省深圳市南山区高新园平安金融大厦98楼智能科技公司</view>
		</view>
		<view class="edit_receiving_address_new" @click="handleChangeAddress">
			<view class="edit_receiving_address_new_top">
				新地址
			</view>
			<view class="edit_receiving_address_new_body">
				<view class="edit_receiving_address_new_body_1">
					<text>请选择收货地址</text>
					<u-icon name="arrow-right" size="12"></u-icon>
				</view>
				<view class="edit_receiving_address_new_body_2">请选择收货地址</view>
				<view class="edit_receiving_address_new_body_3">
					<image src="http://qianxueapplet.suoeryun.com/modified.png"></image>
					<text>已修改地址</text>
				</view>
			</view>
		</view>
		<view class="btm_btm">
			<view class="btm_btm_row">
				<button @click="handleSave" class="row_btn ">提交</button>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { onMounted, onUnmounted } from 'vue';

	onMounted(() => {
		// 修改地址监听
		uni.$on('selectAddress', (item) => {
			console.log(item, 'changeAddress-editReceivingAddress');
		})
	})

	onUnmounted(() => {
		// 销毁修改地址监听
		uni.$off('selectAddress')
	})
	/**
	 * 更改该地址
	 */
	function handleChangeAddress() {
		uni.$u.route('/pages/goodStuff/selectAddress', {

		});
	}

	/**
	 * 提交
	 */
	function handleSave() {
		uni.$emit('editReceivingAddress');
	}
</script>

<style lang="scss" scoped>
	.edit_receiving_address {
		padding: 24rpx;

		.edit_receiving_address_original {
			background-color: #fff;
			border-radius: 12rpx;
			padding: 24rpx;

			.edit_receiving_address_original_title {
				font-size: 36rpx;
				font-weight: 500;
				padding-bottom: 20rpx;
			}

			.edit_receiving_address_original_header {
				font-size: 32rpx;
				font-weight: 500;
				padding-bottom: 8rpx;
			}

			.edit_receiving_address_original_info {
				font-size: 28rpx;
				color: #6A6767;
				line-height: 40rpx;
			}
		}

		.edit_receiving_address_new {
			border-radius: 12rpx;
			margin-top: 24rpx;

			.edit_receiving_address_new_top {
				padding: 8rpx 24rpx 20rpx 24rpx;
				color: #fff;
				background-color: #FF943C;
				border-radius: 12rpx 12rpx 0;
				font-size: 28rpx;
			}

			.edit_receiving_address_new_body {
				padding: 40rpx 24rpx 36rpx 24rpx;
				background-color: #fff;
				border-radius: 12rpx;
				margin-top: -12rpx;

				.edit_receiving_address_new_body_1 {
					font-size: 36rpx;
					font-weight: 500;
					padding-bottom: 20rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
				}

				.edit_receiving_address_new_body_2 {
					font-size: 28rpx;
					color: #666666;
				}

				.edit_receiving_address_new_body_3 {
					display: flex;
					align-items: center;
					margin-top: 16rpx;
					font-size: 28rpx;

					image {
						width: 48rpx;
						height: 48rpx;
						margin-right: 12rpx;
					}
				}
			}
		}
	}
</style>